


********* T-TESTS **********

use jlc_allsentiment.dta, clear

		
*Reacting to a nominee
	ttest overall  if partisanship<3 & event!="Vacancy" & new==0, by(ideo_aligned)
	ttest positive if partisanship<3 & event!="Vacancy" & new==0, by(ideo_aligned)
	ttest negative if partisanship<3 & event!="Vacancy" & new==0, by(ideo_aligned)

*Reacting to a vacancy
	ttest overall  if partisanship<3 & event=="Vacancy" & new==0, by(ideo_aligned)	
	ttest positive if partisanship<3 & event=="Vacancy" & new==0, by(ideo_aligned)
	ttest negative if partisanship<3 & event=="Vacancy" & new==0, by(ideo_aligned)
			
			
			

			
********* O'CONNOR REPLICATION **********


use jlc_sentiment_gallup.dta, clear

* correlations and regressions 
	correlate gallup_support carry_mean_ratio
	regress gallup_support carry_mean_ratio
	
	correlate gallup_support carry_random_mean_ratio
	regress gallup_support carry_random_mean_ratio
	

* Create Figure A1
	set scheme lean1
	twoway  connected gallup_support_01 timevar if year>2017, ///
				msymbol(circle) msize(vsmall) mcolor(black) ///
				lpattern(solid) lcolor(black) lwidth(thin) ///
				  || ///
			connected mean_ratio_01 timevar  if year>2017 & event!="Debate", ///
				msymbol(circle) msize(vsmall) mcolor(black) ///
				lpattern(shortdash) lcolor(black) lwidth(thin) ///
			ytitle("Approval (Standardized)", size(small) color(black))  ///
			ylabel(0(.25)1, labsize(small)) ymtick(##3) ///
			yscale(range(-.036 1)) ///			
			xscale(range(21360 21630)) ///
			xlabel(21362 "Vacancy" 21375 "BMK Announced" 21437 "Hearings" 21458 "Dr. Ford" 21463 "Confirmation" ///
				   21493 "Vacancy" 21501 "ACB Announced" 21517 "Hearings" 21527 "Confirmation" ///
				   21557 "Vacancy" 21587 "KBJ Announced" 21611 "Hearings" 21628 "Confirmation", angle(forty_five) labsize(vsmall)) ///		
			xtitle("") ///
			xline(21478 21542, lwidth(thin) lcolor(gray9)) ///
			text(-.05 21412  "Kavanaugh (2018)", place(n) size(8-pt)) ///
			text(-.05 21510 "Barrett (2020)", place(n) size(8-pt)) ///
			text(-.05 21588 "Jackson (2022)", place(n) size(8-pt)) ///
			title("Public Support and Twitter Sentiment", size(medium)) ///
			legend(off) ///
			text(.97 21590  "Gallup", place(e) size(6-pt)) ///
			text(.56 21590  "Sentiment", place(e) size(6-pt)) ///
			legend(order(1 "Gallup Support" 2 "Sentiment Ratio" 3 "Moving Average") ///
				symplacement(west) nostack cols(3) ///
				rowgap(minuscule) keygap(minuscule) size(8-pt) margin(tiny) ///
				nobox linegap(tiny) region(margin(tiny) lcolor(none)) bmargin(zero) position(7) span)	///
			xsize(7.5) ysize(4.5)
			